//============================================================================
// Name        : AudioProcess.cpp
// Author      : Centny
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <fstream>
#include <AudioBuilder.h>
#include <WavReader.h>
using namespace std;
using namespace centny::abl;
void show(AudioBlock* ab) {
	for (int i = 0; i < 100; i++) {
		if (i % 10 == 0) {
			printf("\n");
		}
		printf("%.2f ", ab->data[i]);
	}
}
#ifdef WIN32
#define WAV_PATH "G:\\Dev\\Audio.wav"
#define OUT_PATH "Debug\\data.txt"
#else
#define WAV_PATH "Data/Audio.wav"
#define OUT_PATH "Debug/data.txt"
#endif
int main() {
	cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
	// Buffers etc..
	WavReader* wr = new WavReader(WAV_PATH);
	fstream fs;
	fs.open(OUT_PATH, ios::out);
	std::pair<AudioBlock*, AudioBlock*> ab = wr->read();
	for (int i = 0; i < ab.first->len; i++) {
		if (i % 10 == 0) {
			fs << endl;
		}
		float v = ab.first->data[i];
		fs << v << " ";
	}
	fs << endl;
	fs.close();
	free(&ab.first);
	delete wr;
	return 0;
}
